/*
============================================================================
FileName	:	XQChatClient.h
Author		:	liyake
Website		:	http://www.liyake.com
Create Data	:	2012-03-08 13:07
Change Data	:	2012-03-08 13:07
Detail		:	The socket client of xqchat application
============================================================================
*/
#ifndef _XQCHAT_CLIENT_H_
#define _XQCHAT_CLIENT_H_

#include <QXmppClient.h>
#include <QXmppRosterManager.h>
#include "XQChatConfiguration.h"

namespace XQChat
{
	class CXQChatRoster;
	class CXQChatClient : public QXmppClient
	{
		Q_OBJECT
	public:
		CXQChatClient(const CXQChatConfiguration& config);
		~CXQChatClient(void);

	public:
		void connectToServer();
		CXQChatConfiguration& configuration(){return m_config;}

	protected slots:
		virtual void onRosterReceived();
		virtual void onPresenceChanged(const QString& bareJid, const QString& resource);
		virtual void onRosterChanged(const QString& bareJid);
		virtual void onSubscriptionReceived(const QString& bareJid);
	//	void onItemAdded(const QString& bareJid);
	//	void onItemChanged(const QString& bareJid);
	//	void onItemRemoved(const QString& bareJid);

signals:
		void rosterReceived();
		void presenceChanged(const QString& fullJid, const QString& resource);
		void rosterChanged(const QString& fullJid);
		void subscriptionReceived(const QString& fullJid);

	protected:
		CXQChatConfiguration m_config;
		QXmppRosterManager* m_pRosterManager;
	};
}

#endif	//_XQCHAT_CLIENT_H_